<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>登陆</title>
    <link rel="stylesheet" type="text/css" href="css/login.css">
    <link rel="stylesheet" type="text/css" href="css/autocomplete.css">
    <script src="http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js"></script>
    <script src="js/base64.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#login").click(function(){
                var userName = $("#userName").val();
                var password = $("#password").val();
                var role = $("#role").val();
                //Ajax调用处理
                var html = $.ajax({
                    type: "POST",
                    url: "http://localhost:1069/login",
                    data: {userName: userName, password: password, role: role},
                    async: false
                }).responseText;
                var result=eval('('+html+')');
                if (result.data.token == "用户名密码错误！" ||result.data.token == "账号不存在！" || result.data.token == "该账号已被锁定，禁止登陆！"){
                    $("#errorInfo").html('<span>'+result.data.token+'</<span>');
                }else {
                    var token = encode(result.data.token);
                    if (role=="student"){
                        window.location.href="index.html?token="+token
                    } else {
                        window.location.href="admin/index.html?token="+token
                    }
                }
            });
        });

    </script>
    <style>
        body {
            width: 100%;

        }
    </style>
</head>

<body>
<div class="logo" style="width: 100%; margin: 0 60px;">
    <a href="student.action" title="南阳理工学院">
        <img border="0" src="images/logosmall.png">
    </a>
</div>
<div class="main" style="background-repeat:no-repeat;">
    <div class="loginpanel">
        <div class="logincontent">
            <form id="ff" action="" method="post">
                <div class="inputline">
                    <p>账号：</p>
                    <input name="userName" type="text" id="userName" style="placeholder:'用户名'">
                </div>
                <div class="displayinfo">
						<span>

						</span>
                </div>
                <div class="inputline">
                    <p>密码：</p>
                    <input name="password" type="password" id="password" style="placeholder:'密　码'">
                </div>
                <div class="displayinfo" id="errorInfo">
						<span>

						</span>
                </div>	
                <div class="inputline">
                    <p>角色：</p>
                    <select name="role" id="role">
                        <option value="student">学　生</option>
                        <option value="admin">管理员</option>
                    </select>
                </div>
                <div class="inputline">
                    <p id = "reason"></p>
                </div>
                <br>
                <div class="inputline">
                    <button class="loginbutton" id="login" style="font-weight: bold" type="button">登&nbsp;&nbsp;&nbsp;&nbsp;陆
                    </button>
                    <a href="forgetPassword.html" class="findpwd">忘记密码？</a>
                </div>

                <div class="divider-content">
                    <span></span>
                </div>

                <div class="announce">
                    <div id="announce1">
                        <span style="color:red;">公告：</span>
                        <span style="font-size:13px;">
								V4.0 更新：大幅提高系统稳定性，用户界面略有调整，安全性进一步提高。如对本系统有建议请点击&nbsp;
								<a href="#" style="font-size:14px;">这里</a>
							</span>
                    </div>
                    <div id="announce2" style="display:none">
                        <span style="color:blue; font-size:14px;">我们推荐您使用下列浏览器访问：</span>
                        <img style="padding-top:10px; padding-left:15px;" src="images/goodbrowser.PNG">
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>

<div class="foot">
    南阳理工学院 2008-2018 版权所有 前研工作室
</div>


</body>

</html>